// luogu P1135 奇怪的电梯
#include <bits/stdc++.h>
using namespace std;
int build[200000];
int step[200000];
int main() {
  int n, a, b;
  cin >> n >> a >> b;
  for (int i = 1; i <= n; i++) {
    cin >> build[i];
  }
  memset(step, -1, sizeof(step));
  queue<int> q;
  q.push(a);
  step[a] = 0;
  while (!q.empty()) {
    int f = q.front(); // 队列的头元素，当前所在的楼层
    q.pop();           // 出队
    if (f == b) {
      cout << step[f] << endl;
      return 0;
    }
    int nxt = f + build[f]; // 向上走
    if (nxt <= n && step[nxt] == -1) {
      q.push(nxt);
      step[nxt] = step[f] + 1;
    }
    nxt = f - build[f]; // 向下走
    if (nxt >= 1 && step[nxt] == -1) {
      q.push(nxt);
      step[nxt] = step[f] + 1;
    }
  }
  cout << -1 << endl;
  return 0;
}